<?php
/*
* 
* Created by PhpStorm.
* Author: 初心 [jialin507@foxmail.com]
* Date: 2017/4/30
*/
require 'common.php';
header("Content-type:text/html;charset=utf-8");
set_time_limit(0);

$host = "http://www.haodou.com";
$root_url = "/recipe/1160198/";

$new_url = [];
$old_url = [];

$new_url[] = $root_url;

for ($i=0; $i<=100; $i++){
    print str_repeat(" ", 4096);

    $url = urls_get($new_url);
    urls_add($new_url, $old_url, $url, 0);
    $content = get_content($host.$url);
    if(count($content['url_li'])>0){
        urls_add_all($new_url, $old_url, $content['url_li']);
    }
    echo '<img style="width:30px;height:30px" src="'.$content['img_url'].'">'.$content['title'].'  链接：<a href="'.$content['url'].'">点击跳转</a> 简介：'.mb_substr($content['info'],0,66).'...<br/>';
    ob_flush();
    flush();

}